package com.entrogy.service.impl;


import com.entrogy.bean.TeacherBasicInfoEntity;
import com.entrogy.bean.UserEntity;
import com.entrogy.bean.VisitEntity;
import com.entrogy.dao.ParentMapper;
import com.entrogy.dao.PositionMapper;
import com.entrogy.dao.VisitMapper;
import com.entrogy.service.VisitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;

/** 访客管理service接口实现类
 * @Author 许红松
 * @date 2019/6/27 0027 下午 3:26
 */
@Service("visitService")
public class VisitServiceImpl implements VisitService {

    @Autowired
    private VisitMapper visitMapper;//访客管理dao接口

    @Autowired
    private ParentMapper parentMapper;//家长管理dao接口

    @Autowired
    private PositionMapper positionMapper;

    @Value("${image.root.path}")
    private String baseImage;

    /**
     * 条件查询访客信息
     * @param map
     * @return
     */
    @Override
    public List<VisitEntity> getVisitEntityList(Map<String, Object> map) {
        return visitMapper.getVisitEntityList(map);
    }

    /**
     * 条件查询访客信息  用于分页查询总数
     * @param map
     * @return
     */
    @Override
    public int getListTotal(Map<String, Object> map) {
        return visitMapper.getListTotal(map);
    }
    /**
     * 新增访客信息
     * @param visitEntity
     * @return
     */
    @Override
    public int addVisitEntity(VisitEntity visitEntity) {
        return visitMapper.addVisitEntity(visitEntity);
    }
    /**
     *   根据id 查询详细信息
     * @return
     */
    @Override
    public Map<String,Object> selectVisitEntityById(int id) {
        return visitMapper.selectVisitEntityById(id);
    }
    /**
     *  审核
     * @param map
     * @return
     */
    @Override
    public int UpdateStype(Map<String, Object> map) {
        return visitMapper.UpdateStype(map);
    }


    /**
     *  获取班主任信息
     * @param gradeId
     * @return
     */
    @Override
    public TeacherBasicInfoEntity getUserId(int gradeId, int schoolCode) {
        return positionMapper.getClassLeader(gradeId,schoolCode);
    }
    /**
     *  查询用户职位关联表信息
     * @param userId
     * @return
     */
    @Override
    public UserEntity getUserById( String  userId){
        return visitMapper.getUserById(userId);
    };

    /**
     *   老师查询的审核信息
     * @param map
     * @return
     */
    @Override
    public List<VisitEntity>  getTeacherVisit(Map<String,Object> map){
        return visitMapper.getTeacherVisit(map);
    };

    /**
     *   老师查询的审核总数
     * @param map
     * @return
     */
    @Override
    public int  getTeacherVisitTotal(Map<String,Object> map){
        return visitMapper.getTeacherVisitTotal(map);
    }

    /**
     *   获取保安的list
     * @param map
     * @return
     */
    @Override
    public List<UserEntity> getSecurityList(Map<String, Object> map) {
        return visitMapper.getSecurityList(map);
    }

    @Override
    public VisitEntity getVisitById(Integer id) {
        return visitMapper.getVisitById(id);
    }

    @Override
    public Integer getVisitorEnableStatus() {
        return visitMapper.getVisitorEnableStatus();
    }


}
